package com.beiing.tianshuai.tianshuai.dongtai.util;

import com.beiing.tianshuai.tianshuai.entity.DynamicCommentAndReplyBean;

import java.util.List;

/**
 * Created by LZQ on 2017/12/19.
 * Description: 冒泡排序
 */

public class BubbleSort {

    public static List<DynamicCommentAndReplyBean> sortList(List<DynamicCommentAndReplyBean> CARBeanList){
        for (int i = 0; i < CARBeanList.size() - 1; i++) {
            for (int j = 0; j < CARBeanList.size() - 1 - i; j++) {
                if (Long.parseLong(CARBeanList.get(j).getCreate_time()) < Long.parseLong(CARBeanList.get(j + 1).getCreate_time())){
                    DynamicCommentAndReplyBean tempBean = CARBeanList.get(j);
                    CARBeanList.set(j, CARBeanList.get(j + 1));
                    CARBeanList.set(j + 1, tempBean);
                }
            }
        }
        return CARBeanList;
    }
}
